package org.scorpio.common.util;

import org.scorpio.common.base.HttpResult;
import org.scorpio.common.constant.ResultEnum;

/**
 * <p>
 * Title:HttpResultUtils
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Company:
 * </p>
 * 
 * @author Li Enbo
 * @date 2017年11月21日下午3:27:51
 */
public class HttpResultUtils<T> {
	/**
	 * 成功响应集
	 * 
	 * @param data
	 * @return
	 */
	public HttpResult<T> successResult(T data) {
		HttpResult<T> result = new HttpResult<T>(ResultEnum.SUCCESS, data);
		return result;
	}

	/**
	 * 成功响应集
	 * 
	 * @param data
	 * @return
	 */
	public HttpResult<T> successResult() {
		HttpResult<T> result = new HttpResult<T>(ResultEnum.SUCCESS, null);
		return result;
	}

	/**
	 * 自定义返回 但是必须是枚举类型
	 * 
	 * @param resultEnum
	 * @return
	 */
	public HttpResult<T> errorResult(ResultEnum resultEnum) {
		HttpResult<T> result = new HttpResult<T>(resultEnum, null);
		return result;
	}

}
